﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BKH.BLL;

namespace BKH.MyUserControl.UCHienThi
{
    public partial class UCTimKiemBN : UserControl
    {
        public UCTimKiemBN()
        {
            InitializeComponent();
        }
        BenhNhanBUO bnbuo = new BenhNhanBUO();
        private void btnTim_Click(object sender, EventArgs e)
        {
            //Tim kiem theo ten benh nhan
            if (radioButton1.Checked==true)
            {
                String hoten = txtTimTheoTen.Text.Trim();                
                String[] s = hoten.Split();
                String ten="";
                for (int i = 1; i < s.Length; i++)
                {
                    ten += " "+s[i];
                }                
                dataGridView1.DataSource=bnbuo.Search(ten.Trim());
                MessageBox.Show(ten);
            }
            //tim kiem theo ma benh nhan
            if (radioButton2.Checked==true)
            {
                dataGridView1.DataSource = bnbuo.Search(int.Parse(txtTimTheoMaBN.Text));
            }

            //Tim kiem theo CMND
            if (radioButton3.Checked==true)
            {
                dataGridView1.DataSource = bnbuo.SearchByCMND(txtTimTheoCMND.Text);
            }
        }
    }
}
